/*
* Js模块文件的入口
* by hyi
*/
(function($) {
	var rp = getSearchParams();
	var dataType = rp.dataType || 1;
	var objType = rp.objType ||'重点实验室';
    var map = new BMap.Map("map", {enableMapClick: false});    // 创建Map实例
	map.setMapStyle(mapStyle);
	map.centerAndZoom("太原", 7);
	// map.centerAndZoom(new BMap.Point(110.66,35.31), 12);  // 初始化地图,设置中心点坐标和地图级别
	map.enableScrollWheelZoom(); // 开启鼠标滚轮缩放

	function initBoundary(){
		var bdary = new BMap.Boundary();
		bdary.get("山西", function(rs){
			var count = rs.boundaries.length; //行政区域的点有多少个
			for(var i = 0; i < count; i++){
				var ply = new BMap.Polygon(rs.boundaries[i], {strokeWeight: 1, strokeColor: "#ff0000"}); //建立多边形覆盖物
				map.addOverlay(ply);  //添加覆盖物
			}
		})
	}
	var mapvLayer;

	function initData(){

		let params ={dataType:dataType,objType:objType};
		$.get(baseUrl+"/gis/sx", params,function (rep) {
			console.log(rep.data.length)
			var dataSet = new mapv.DataSet(rep.data);
			if(mapvLayer){
				mapvLayer.destroy();
			}
			var options = {
				fillStyle: '#FF8000',
				size: 5,
                draw: 'simple',
			}

			mapvLayer = new mapv.baiduMapLayer(map, dataSet, options);
		});
	}
	// initBoundary();
	initData();
})(jQuery)

